#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

bool fun(int i)
{
	int count = log10(i) + 1;
	int square = pow(i, 2);
	int m = pow(10, count);
	if (square % m == i)
	{
		return true;
	}
	return false;
}

int main()
{
	int n = 0;
	int a[700] = { 0 };
	for (int i = 1; i <= 700; i++)
	{
		bool ret = fun(i);
		if (ret)
		{
			a[n++] = i;
		}
	}
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << ' ';
	}
	cout << endl;
	cout << n;


	return 0;
}